<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta charset="utf-8"/>
    <title>{$meta_title}</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"/>
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/login.css" media="all">

</head>
<body>
<div class="layadmin-user-login" id="LAY-user-login">
    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
        <img src="__PUBLIC__/Admin/images/logo2.png">
           <!--  <h2>{:C('PLATFORM_CONTRACT_NAME')}</h2> -->
           <!--  <p>后台管理系统</p> -->
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon" for="LAY-user-login-username">&#xe770;</label>
                <input type="text" name="username" id="LAY-user-login-username" lay-verType="tips" lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon" for="LAY-user-login-password">&#xe688;</label>
                <input type="password" name="password" id="LAY-user-login-password" lay-verType="tips" lay-verify="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon" for="LAY-user-login-vercode">&#xe672;</label>
                        <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verType="tips" lay-verify="required" placeholder="图形验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img src="{:U('Public/getCode')}" class="layadmin-user-login-codeimg" id="get-vercode">
                        </div>
                    </div>
                </div>
            </div>
            <!--<div class="layui-form-item" style="margin-bottom: 20px;">-->
                <!--<input type="checkbox" name="remember" lay-skin="primary" title="记住密码"/>-->
                <!--<a href="javascript:;" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>-->
            <!--</div>-->
            <div class="layui-form-item">
                <button type="button" class="layui-btn layui-btn-fluid" lay-submit lay-filter="login-submit">登 录</button>
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other" style="display: none">
                <label>社交账号登录</label>
                <a href="javascript:;"><img src="__PUBLIC__/Admin/images/icon_qq.png" width="30px"/></a>
                <a href="javascript:;"><img src="__PUBLIC__/Admin/images/icon_weixin.png" width="30px"/></a>
                <a href="javascript:;"><img src="__PUBLIC__/Admin/images/icon_weibo.png" width="30px"/></a>
                <a href="javascript:;" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
            </div>
        </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
        <p>Copyright © 2019 </p>
        <p><a href="javascript:;"></a> All Rights Reserved.</p>
    </div>
</div>

<script type="text/javascript" src="__PUBLIC__/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['form','layer'], function () {
        var form = layui.form,layer = layui.layer;
        layer.config({
            offset:'550px'
        });
        //提交
        form.on('submit(login-submit)', function (obj) {
            // todo ajax login
            $.post('{:U("Public/login")}',obj.field,function (res) {
                if (res.code === 1){
                    layer.msg(res.msg,{'time':2000},function () {
                        window.location.href = res.url;
                    })
                } else {
                    layer.msg(res.msg,{'time':2000},function () {
                        window.location.href = res.url;
                    })
                }
            });
            return false;
        });

        $("#get-vercode").click(function () {
            // todo 获取验证码
            var url = '{:U("Public/getCode")}';
            if (url.indexOf("?") > 0){
                url += '&'+Math.random();
            } else {
                url += '?'+Math.random();
            }
            $("#get-vercode").attr('src',url);
        });
    });
    $(document).ready(function(){
        $(":text").keydown(function(e){
            var curKey = e.which;
            if(curKey == 13){
                $(".layui-btn.layui-btn-fluid").click();
                return false;
            }
        });
    });
</script>
</body>
</html>